2 Lecture
CS401
Midterm & Final Term Short Notes
Data Declaration
Data declaration refers to the process of declaring or defining data types, variables, and constants in a computer program. It is an important aspect of programming as it helps the compiler or interpreter to allocate memory space and enforce dat
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
Which keyword is used to declare a variable in C language? a. int b. float c. char d. all of the above Answer: d. all of the above Which keyword is used to declare a constant in C language? a. var b. const c. let d. final Answer: b. const Which data type is used to represent characters in C language? a. char b. int c. float d. double Answer: a. char Which data type is used to represent decimal numbers in C language? a. char b. int c. float d. double Answer: c. float Which data type is used to represent Boolean values in C language? a. bool b. int c. char d. float Answer: C. bool Which keyword is used to define a pointer variable in C language? a. * b. & c. $ d. # Answer: a. * Which keyword is used to define an array in C language? a. array b. list c. table d. none of the above Answer: d. none of the above Which data type is used to represent whole numbers in C language? a. char b. int c. float d. double Answer: b. int Which keyword is used to declare a variable as a constant pointer in C language? a. const b. static c. volatile d. extern Answer: a. const Which data type is used to represent large numbers in C language? a. char b. int c. long d. double Answer: c. long
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is data declaration? Answer: Data declaration is the process of defining or declaring data types, variables, and constants in a computer program. What is the purpose of declaring data types in a program? Answer: Declaring data types helps the compiler allocate memory space and enforce data type constraints, making the program more efficient and less prone to errors. What is a variable in programming? Answer: A variable is a named memory location that holds a value, which can be changed during the execution of a program. How do you declare a constant in C language? Answer: Constants are declared using the const keyword followed by the data type and variable name. What is the difference between a variable and a constant? Answer: Variables can have their values changed during the execution of a program, whereas constants have fixed values that cannot be changed. What is the purpose of using pointers in programming? Answer: Pointers are used to store memory addresses and to access and manipulate data indirectly. How do you declare an array in C language? Answer: Arrays are declared using square brackets after the variable name, with the size of the array specified in the brackets. What is a data type in programming? Answer: A data type is a classification of data into different categories, such as integers, characters, and floating-point numbers, based on their characteristics and the operations that can be performed on them. What is the significance of declaring variables with appropriate data types? Answer: Declaring variables with appropriate data types ensures that the correct amount of memory is allocated and that data is manipulated and stored correctly. How do you declare a variable as a constant pointer in C language? Answer: Constant pointers are declared using the const keyword before the pointer type and variable name.